#include "SpaEnumTranslator.h"


SpaEnumTranslator::SpaEnumTranslator(void) {
}


SpaEnumTranslator::~SpaEnumTranslator(void) {
}

DesignEntityType SpaEnumTranslator::translateRelationshipArgTypeToDesignEntityType(RelationshipArgumentType relArg) {
	switch (relArg) {
	case SYNONYM_ASSIGN:
		return ASSIGN;
		break;
	case SYNONYM_CONSTANT:
		return CONSTANT;
		break;
	case SYNONYM_PROCEDURE:
		return PROCEDURE;
		break;
	case SYNONYM_PROGLINE:
		return PROG_LINE;
		break;
	case SYNONYM_STMT:
		return STMT;
		break;
	case SYNONYM_VARIABLE:
		return VARIABLE;
		break;
	case SYNONYM_WHILE:
		return WHILE;
		break;
	case SYNONYM_IF:
		return IF;
		break;
	case SYNONYM_CALL:
		return CALL;
		break;
	default:
		return INVALID_DESIGN_ENTITY;
		break;
	}
}

RelationshipArgumentType SpaEnumTranslator::translateDesignEntityTypeToRelationshipArgumentType(DesignEntityType entType) {
	switch (entType) {
	case STMT:
		return SYNONYM_STMT;
		break;
	case ASSIGN:
		return SYNONYM_ASSIGN;
		break;
	case WHILE:
		return SYNONYM_WHILE;
		break;
	case VARIABLE:
		return SYNONYM_VARIABLE;
		break;
	case CONSTANT:
		return SYNONYM_CONSTANT;
		break;
	case PROG_LINE:
		return SYNONYM_PROGLINE;
		break;
	default:
		return INVALID_ARG;
		break;
	}
}

PatternType SpaEnumTranslator::translateDesignEntityTypeToPatternType(DesignEntityType entType) {
	switch (entType) {
	case ASSIGN:
		return PATTERN_ASSIGN;
		break;
	case WHILE:
		return PATTERN_WHILE;
		break;
	case IF:
		return PATTERN_IF;
		break;
	default:
		return PATTERN_INVALID;
		break;
	}
}

DesignEntityType SpaEnumTranslator::translatePatternTypeToDesignEntityType(PatternType patternType) {
	switch (patternType) {
	case PATTERN_ASSIGN:
		return ASSIGN;
		break;
	case PATTERN_WHILE:
		return WHILE;
		break;
	case PATTERN_IF:
		return IF;
		break;
	default:
		return INVALID_DESIGN_ENTITY;
		break;
	}
}

RelationshipArgumentType SpaEnumTranslator::translatePatternTypeToRelationshipArgumentType(PatternType patternType) {
	switch (patternType) {
	case PATTERN_ASSIGN:
		return SYNONYM_ASSIGN;
		break;
	case PATTERN_WHILE:
		return SYNONYM_WHILE;
		break;
	case PATTERN_IF:
		return SYNONYM_IF;
		break;
	default:
		return INVALID_ARG;
		break;
	}
}

DesignEntityType SpaEnumTranslator::translateTypeEntityLineToDesignEntityType(Type::Entity::Line lineEntity){
	DesignEntityType designEntity;

	switch(lineEntity){
	case Type::Entity::ALL_LINE_ENTITY:
		designEntity = STMT;
		break;
	case Type::Entity::ASSIGNMENT_LINE_ENTITY:
		designEntity = ASSIGN;
		break;
	case Type::Entity::WHILE_LINE_ENTITY:
		designEntity = WHILE;
		break;
	case Type::Entity::IF_LINE_ENTITY:
		designEntity = IF;
		break;
	case Type::Entity::CALL_LINE_ENTITY:
		designEntity = CALL;
		break;
	default:
		designEntity = INVALID_DESIGN_ENTITY;
	}

	return designEntity;
}

Type::Entity::Line SpaEnumTranslator::translateDesignEntityTypeToTypeEntityLine(DesignEntityType designEntity){
	Type::Entity::Line lineEntity;

	switch(designEntity){
	case STMT:
	case PROG_LINE:
		lineEntity = Type::Entity::ALL_LINE_ENTITY;
		break;
	case ASSIGN:
		lineEntity = Type::Entity::ASSIGNMENT_LINE_ENTITY;
		break;
	case WHILE:
		lineEntity = Type::Entity::WHILE_LINE_ENTITY;
		break;
	case IF:
		lineEntity = Type::Entity::IF_LINE_ENTITY;
		break;
	case CALL:
		lineEntity = Type::Entity::CALL_LINE_ENTITY;
		break;
	default:
		lineEntity = Type::Entity::INVALID_LINE_ENTITY;
	}

	return lineEntity;
}